const fs = require('fs');
const path = require('path');
var dirPath = __dirname;

console.log("请输入要创建的文件夹：");
process.stdin.on('data',(data)=>{
    var datas = data.toString('utf-8');
    var holders = datas.split(' ');
    var holderPath = path.join(dirPath,'/'+holders[1].slice(0,-2))
    if(holders[0] == 'mkdir'){
        fs.mkdir(holderPath,(err)=>{
            if(err){
                console.log(err);
            }
        })
    }
    console.log("文件夹创建成功！！！")
    // if(datas=='/r/n'){
        // process.stdin.emit('end');
    // }
})
// process.stdin.on('end', ()=>{
//     process.stdout.write('end');
// });
